<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.erp.hibernate.beans.Employee" %>
<%@ page import="java.util.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link href="main.css" rel="stylesheet" type="text/css"/>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<script>
        function check(){
           if (confirm("您确定入库吗？")){
              if (document.getElementById("goodsid").value==""){
                  alert("物品编号不能为空！");
                  return false;
              }
              if (document.getElementById("goodsname").value==""){
                  alert("物品名称不能为空！");
                  return false;
              }
              if (document.getElementById("trademark").value==""){
                  alert("牌号不能为空！");
                  return false;
              }                          
              if (document.getElementById("quantity").value==""||!/^[1-9]\d*$/.test(document.getElementById("quantity").value)){
                alert("请输入正确的入库数量！");
              	  return false;               
         	  }
              if (document.getElementById("spec").value==""){
                  alert("规格不能为空！");
                  return false;
              }
              if (document.getElementById("billid").value==""){
                  alert("入库单号码不能为空！");
                  return false;
              }
              if (document.getElementById("depottype").value==""){
                  alert("库房号不能为空！");
                  return false;
              }
           }
        }
        </script>
</head>
	<body>
		<%
			Date nowdate=new Date();
			SimpleDateFormat ss=new SimpleDateFormat("yyyy-MM-dd");
			String orderdate=ss.format(nowdate);
			Employee em=(Employee)session.getAttribute("employee");
		%>
	    <form action="inbill!insert.do" name="form" method="post">
		<table class="tableborder" cellspacing="1" cellpadding="4" width="98%" align="center">
			<colgroup align="left">
				<col class="altbg1" width="20%"/>							
				<col class="altbg2" width="30%"/>
				<col class="altbg1" width="20%"/>
				<col class="altbg2" width="30%"/>
			</colgroup>
			<tr>
			   <td colspan="4" class="header">新增入库单</td>
			</tr>
			<tr>
				<td><font color="red">*</font>物品编号：</td>
				<td><input id="goodsid" name="inbill.goodsid" type="text" maxlength="40"/></td>
				<td><font color="red">*</font>入库人员：</td>
				<td><span><%=em.getName()%></span></td>
			</tr>
			<tr>
				<td><font color="red">*</font>物品名称：</td>
				<td><input id="goodsname" name="inbill.goodsname" type="text" value="" maxlength="40"/></td>
				<td><font color="red">*</font>入库日期：</td>
				<td><span><%=orderdate%></span>
				</td>
			</tr>
			<tr>
				<td><font color="red">*</font>牌号：</td>
				<td><input id="trademark" name="inbill.trademark" type="text" value="" maxlength="40"/></td>
				<td><font color="red">*</font>入库数量：</td>
				<td><input id="quantity" name="inbill.quanlity" type="text" maxlength="10"/></td>
			</tr>
			<tr>
				<td><font color="red">*</font>规格：</td>
				<td><input id="spec" name="inbill.spec" type="text" value="" maxlength="40"/></td>
				<td><font color="red">*</font>入库单号码：</td>
				<td><input id="billid" name="inbill.billid" type="text" maxlength="40"/></td>
			</tr>
			<tr>
				<td><font color="red">*</font>库房号：</td>
				<td clospan="3"><input id="depottype" name="inbill.depottype" type="text" maxlength="10" value="1"/></td>
			</tr>
			<tr>
				<td colspan="4" bgcolor="d6e0ef" align="center"><input type="submit"  value="入库" onclick="return check();"/></td>
			</tr>
      </table>
      </form>
	</body>
</html>
